package com.rr.mymoney.jsf.util;

import javax.faces.context.FacesContext;

import com.rr.mymoney.utils.Filter;

public class FilterUtils {
    public static Filter getFilterFromSession(String filterName) {
	Filter filter = (Filter) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(filterName);
	if (filter == null) {
	    return new Filter();
	} else {
	    return filter;
	}
    }

    public static void saveFilterToSession(Filter filter, String filterName) {
	FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(filterName, filter);
    }
}
